package com.ruoyi.project.drug.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.drug.domain.DrugFactory;
import com.ruoyi.project.drug.mapper.DrugFactoryMapper;
import com.ruoyi.project.drug.service.IDrugFactoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DrugFactoryServiceImpl implements IDrugFactoryService {
    //声明mapper属性
    @Autowired
    private DrugFactoryMapper drugFactoryMapper;
    //根据ID查询厂家信息
    @Override
    public DrugFactory selectDrugFactoryById(Long factId) {
        return drugFactoryMapper.selectDrugFactoryById(factId);
    }
    //查询厂家信息
    @Override
    public List<DrugFactory> selectDrugFactoryList(DrugFactory drugFactory) {
        return drugFactoryMapper.selectDrugFactoryList(drugFactory);
    }
    //新增厂家
    @Override
    public int insertDrugFactory(DrugFactory drugFactory) {
        drugFactory.setCreateTime(DateUtils.getNowDate());
        return drugFactoryMapper.insertDrugFactory(drugFactory);
    }
    //修改厂家信息
    @Override
    public int updateDrugFactory(DrugFactory drugFactory) {
        drugFactory.setCreateTime(DateUtils.getNowDate());
        return drugFactoryMapper.updateDrugFactory(drugFactory);
    }
    //删除多个厂家信息
    @Override
    public int deleteDrugFactoryByIds(Long[] factIds) {
        return drugFactoryMapper.deleteDrugFactoryByIds(factIds);
    }
    //删除单个厂家信息
    @Override
    public int deleteDrugFactoryById(Long factId) {
        return drugFactoryMapper.deleteDrugFactoryById(factId);
    }
}
